package com.elong.android.specialhouse.activity;

import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.elong.android.specialhouse.R;
import com.elong.android.specialhouse.base.BaseVolleyActivity;
import com.elong.android.specialhouse.utils.ToastUtils;
import com.elong.framework.netmid.response.IResponse;

public class LatestActivity extends BaseVolleyActivity<IResponse<?>> {
	private WebView mWebView;
	@Override
	protected void initContentView() {
		setContentView(R.layout.act_latest_activity);
		setHeader("最新活动");
		mWebView = (WebView) findViewById(R.id.webView_latest_act);
		mWebView.loadUrl("http://www.elong.com");
		WebSettings settings = mWebView.getSettings();
		settings.setJavaScriptEnabled(true);
		settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
		mWebView.setWebViewClient(new WebViewClient(){
	           @Override
		        public boolean shouldOverrideUrlLoading(WebView view, String url) {
		            // TODO Auto-generated method stub
		               //返回值是true的时候控制去WebView打开，为false调用系统浏览器或第三方浏览器
		             view.loadUrl(url);
		            return true;
		        }

	       });
		mWebView.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                // TODO Auto-generated method stub
                if (newProgress == 100) {
                    // 网页加载完成
                		ToastUtils.show("加载完成");
                } else {
                    // 加载中
                		ToastUtils.show("加载中...");
                }

            }
        });
	}

}
